<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/dute_favicon_32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/dute_favicon_16x16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <link rel="manifest" href="/images/manifest.json">
  <meta name="msapplication-config" content="/images/browserconfig.xml">
  <meta http-equiv="Cache-Control" content="no-transform">
  <meta http-equiv="Cache-Control" content="no-siteapp">
  <meta name="google-site-verification" content="mpI5dkydstZXl6UcDCppqktXK0bbvqdZ6LkZ3KNk4Iw">
  <meta name="baidu-site-verification" content="code-a1LksZX2Ds">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"whitestore.top","root":"/","scheme":"Gemini","version":"7.8.0","exturl":true,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":true,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="Jmeter压力测试回顾最后部分">
<meta property="og:type" content="article">
<meta property="og:title" content="Jmeter压力测试回顾(四)">
<meta property="og:url" content="https://whitestore.top/2021/01/18/jmeter-test4/index.html">
<meta property="og:site_name" content="爱看书的阿东">
<meta property="og:description" content="Jmeter压力测试回顾最后部分">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210118223554.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210118224902.png">
<meta property="og:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210118224707.png">
<meta property="article:published_time" content="2021-01-18T15:35:19.000Z">
<meta property="article:modified_time" content="2023-07-16T06:28:09.224Z">
<meta property="article:author" content="阿东">
<meta property="article:tag" content="Jmeter压力测试回顾最后部分">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210118223554.png">

<link rel="canonical" href="https://whitestore.top/2021/01/18/jmeter-test4/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Jmeter压力测试回顾(四) | 爱看书的阿东</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="爱看书的阿东" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">爱看书的阿东</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">赐他一块白色石头，石头上写着新名</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-sitemap">

    <a href="/sitemap.xml" rel="section"><i class="fa fa-fw fa-sitemap"></i>站点地图</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://whitestore.top/2021/01/18/jmeter-test4/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="阿东">
      <meta itemprop="description" content="随遇而安">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="爱看书的阿东">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Jmeter压力测试回顾(四)
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-01-18 23:35:19" itemprop="dateCreated datePublished" datetime="2021-01-18T23:35:19+08:00">2021-01-18</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2023-07-16 14:28:09" itemprop="dateModified" datetime="2023-07-16T14:28:09+08:00">2023-07-16</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E6%B5%8B%E8%AF%95/" itemprop="url" rel="index"><span itemprop="name">测试</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021/01/18/jmeter-test4/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021/01/18/jmeter-test4/" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>6.1k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>6 分钟</span>
            </span>
            <div class="post-description">Jmeter压力测试回顾最后部分</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="回顾Jmeter压力测试（四）"><a href="#回顾Jmeter压力测试（四）" class="headerlink" title="回顾Jmeter压力测试（四）"></a>回顾Jmeter压力测试（四）</h1><p>下面部分为非GUI部分的内容实战。</p>
<a id="more"></a>

<h2 id="非GUI部分"><a href="#非GUI部分" class="headerlink" title="非GUI部分"></a>非GUI部分</h2><h2 id="阿里云安装jmeter（jmeter5）"><a href="#阿里云安装jmeter（jmeter5）" class="headerlink" title="阿里云安装jmeter（jmeter5）"></a>阿里云安装jmeter（jmeter5）</h2><ol>
<li>配置JDK1.8的环境，Linux配置Jdk请自行查找相关资料</li>
<li>阿里云安装jmeter，移动到自己喜欢的位置</li>
</ol>
<blockquote>
<p>下载方式：<code>wget https://apachemirror.sg.wuchna.com//jmeter/binaries/apache-jmeter-5.4.tgz</code></p>
</blockquote>
<ol start="3">
<li>启动非GUI测试：我们可以在window上使用gui版本编写好对应的jmx，然后再执行压测。</li>
</ol>
<h3 id="Jmeter非GUI界面-参数讲解-必须掌握"><a href="#Jmeter非GUI界面-参数讲解-必须掌握" class="headerlink" title="Jmeter非GUI界面 参数讲解(必须掌握)"></a>Jmeter非GUI界面 参数讲解(必须掌握)</h3><p>在进行实战之前了解一下基本的参数：</p>
<p>官方配置文件地址： <span class="exturl" data-url="aHR0cDovL2ptZXRlci5hcGFjaGUub3JnL3VzZXJtYW51YWwvZ2V0LXN0YXJ0ZWQuaHRtbA==" title="http://jmeter.apache.org/usermanual/get-started.html">http://jmeter.apache.org/usermanual/get-started.html<i class="fa fa-external-link"></i></span></p>
<h4 id="基础命令参数："><a href="#基础命令参数：" class="headerlink" title="基础命令参数："></a>基础命令参数：</h4><ul>
<li><strong>-h</strong>     帮助</li>
<li><strong>-n</strong>     非GUI模式</li>
<li><strong>-t</strong>     指定要运行的 JMeter 测试脚本文件</li>
<li><strong>-l</strong>      记录结果的文件 每次运行之前，(要确保之前没有运行过,即xxx.jtl不存在，不然报错)</li>
<li><strong>-r</strong>      Jmter.properties文件中指定的所有远程服务器</li>
<li><strong>-e</strong>      在脚本运行结束后生成html报告</li>
<li><strong>-o</strong>      用于存放html报告的目录（目录要为空，不然报错）</li>
</ul>
<p>案例如下：</p>
<h3 id="如何使用linux-jmeter压测？"><a href="#如何使用linux-jmeter压测？" class="headerlink" title="如何使用linux jmeter压测？"></a>如何使用linux jmeter压测？</h3><p>下面的教程为构建一个最简单的压测方式：</p>
<ol>
<li>构建一个简单的http压测请求，使用如下的方式：</li>
</ol>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210118223554.png" alt=""></p>
<ol start="2">
<li>保存为<code>.jmx</code>后缀的文件</li>
<li>将文件的内容上传到服务器，命令行进入到对应的Bin目录下面</li>
<li>执行命令：<code>./jmeter -n -t ./plan/LinuxPlan.jmx -l ./plan/result.jtl -e -o ./resultreport</code></li>
</ol>
<blockquote>
<p>上面的命令效果如下：：</p>
<p>-l 指定了结果文件的存放位置</p>
<p>-o 指定html报告的目录位置</p>
<p>-t 指定了脚本文件的存放位置</p>
<p>-n 代表使用非GUI模式运行</p>
</blockquote>
<h3 id="Jmeter压测减少资源使用的一些建议，即压测结果更准确"><a href="#Jmeter压测减少资源使用的一些建议，即压测结果更准确" class="headerlink" title="Jmeter压测减少资源使用的一些建议，即压测结果更准确"></a>Jmeter压测减少资源使用的一些建议，即压测结果更准确</h3><p>1、使用非GUI模式：jmeter -n -t test.jmx -l result.jtl</p>
<p>2、少使用Listener， 如果使用-l参数，它们都可以被删除或禁用。</p>
<p>3、在加载测试期间不要使用“查看结果树”或“查看结果”表监听器，只能在脚本阶段使用它们来调试脚本。</p>
<p>4、包含控制器在这里没有帮助，因为它将文件中的所有测试元素添加到测试计划中。]</p>
<p>5、不要使用功能模式,使用CSV输出而不是XML</p>
<p>6、只保存你需要的数据,尽可能少地使用断言</p>
<p>7、如果测试需要大量数据，可以提前准备好测试数据放到数据文件中，以CSV Read方式读取。</p>
<p>8、用内网压测，减少其他带宽影响压测结果</p>
<p>9、如果压测大流量，尽量用多几个节点以非GUI模式向服务器施压</p>
<p>官方推荐 ：<span class="exturl" data-url="aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9qbWV0ZXIvdXNlcm1hbnVhbC9iZXN0LXByYWN0aWNlcy5odG1sI2xlYW5fbWVhbg==" title="http://jakarta.apache.org/jmeter/usermanual/best-practices.html#lean_mean">http://jakarta.apache.org/jmeter/usermanual/best-practices.html#lean_mean<i class="fa fa-external-link"></i></span></p>
<h2 id="Jmeter压测结果聚合报告分析"><a href="#Jmeter压测结果聚合报告分析" class="headerlink" title="Jmeter压测结果聚合报告分析"></a>Jmeter压测结果聚合报告分析</h2><p>一般情况下，我们可以根据<code>-o</code>这个参数在Linux中生成对应的聚合报告，根据聚合报告我们可以分析压测的结果</p>
<p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210118224902.png" alt=""></p>
<p>根据上面的聚合报告，我们可以从<code>index.html</code>当中看到基本的聚合报告分析内容和结果。</p>
<h3 id="dashboard结果分析："><a href="#dashboard结果分析：" class="headerlink" title="dashboard结果分析："></a>dashboard结果分析：</h3><p>​<br>​    2）APDEX(Application performance Index)<br>​        apdex:应用程序性能指标,范围在0~1之间，1表示达到所有用户均满意<br>​        T(Toleration threshold)：可接受阀值<br>​        F(Frustration threshold)：失败阀值<br>​<br>​    3）Requests Summary<br>​        OK:成功率<br>​        KO:失败率<br>​    4）Statistics 统计数据<br>​        lable:sampler采样器名称<br>​<br>        samples:请求总数，并发数*循环次数<br>        KO:失败次数<br>        Error%:失败率</p>
<pre><code>Average:平均响应时间
Min:最小响应时间
Max:最大响应时间
90th pct: 90%的用户响应时间不会超过这个值（关注这个就可以了）
2ms,3ms,4,5,2,6,8,3,9

95th pct: 95%的用户响应时间不会超过这个值
99th pct: 99%的用户响应时间不会超过这个值 (存在极端值)
throughtput:Request per Second吞吐量 qps

received:每秒从服务器接收的数据量
send：每秒发送的数据量</code></pre><p><img src="https://gitee.com/lazyTimes/imageReposity/raw/master/img/20210118224707.png" alt=""></p>
<h4 id="Test-and-Report-informations"><a href="#Test-and-Report-informations" class="headerlink" title="Test and Report informations"></a>Test and Report informations</h4><ul>
<li>Source file：jtl文件名</li>
<li>Start Time ：压测开始时间</li>
<li>End Time ：压测结束时间</li>
<li>Filter for display：过滤器</li>
<li>Lable:sampler：采样器名称</li>
</ul>
<h4 id="APDEX-Application-performance-Index"><a href="#APDEX-Application-performance-Index" class="headerlink" title="APDEX(Application performance Index)"></a>APDEX(Application performance Index)</h4><p>apdex:应用程序性能指标,范围在0~1之间，1表示达到所有用户均满意</p>
<ul>
<li>T(Toleration threshold)：可接受阀值</li>
<li>F(Frustration threshold)：失败阀值</li>
</ul>
<h4 id="Requests-Summary"><a href="#Requests-Summary" class="headerlink" title="Requests Summary:"></a>Requests Summary:</h4><ul>
<li>OK:成功率</li>
<li>KO:失败率</li>
</ul>
<h4 id="Statistics-统计数据"><a href="#Statistics-统计数据" class="headerlink" title="Statistics 统计数据"></a>Statistics 统计数据</h4><p>这一部分是主要内容：</p>
<ul>
<li>lable: sampler的名称</li>
<li>Samples: 一共发出去多少请求,例如10个用户，循环10次，则是 100</li>
<li>Average: 平均响应时间</li>
<li>Median: 中位数，也就是 50％ 用户的响应时间</li>
<li>90% Line : 90％ 用户的响应不会超过该时间 （90% of the samples took no more than this time. The remaining samples at least as long as this）</li>
<li>95% Line : 95％ 用户的响应不会超过该时间</li>
<li>99% Line : 99％ 用户的响应不会超过该时间</li>
<li>min : 最小响应时间</li>
<li>max : 最大响应时间</li>
<li>Error%：错误的请求的数量/请求的总数</li>
<li>**Throughput： 吞吐量——默认情况下表示每秒完成的请求数（Request per Second) 可类比为qps<pre><code>KB/Sec: 每秒接收数据量**</code></pre></li>
</ul>
<h3 id="charts讲解"><a href="#charts讲解" class="headerlink" title="charts讲解"></a>charts讲解</h3><h4 id="Over-Time（随着时间的变化）"><a href="#Over-Time（随着时间的变化）" class="headerlink" title="Over Time（随着时间的变化）"></a>Over Time（随着时间的变化）</h4><ul>
<li>Response Times Over Time：响应时间变化趋势</li>
<li>Response Time Percentiles Over Time (successful responses)：最大，最小，平均，用户响应时间分</li>
<li>Active Threads Over Time：并发用户数趋势</li>
<li>Bytes Throughput Over Time：每秒接收和请求字节数变化，蓝色表示发送，黄色表示接受</li>
<li>Latencies Over Time：平均响应延时趋势</li>
<li>Connect Time Over Time    ：连接耗时趋势</li>
</ul>
<h4 id="Throughput"><a href="#Throughput" class="headerlink" title="Throughput"></a>Throughput</h4><ul>
<li>Hits Per Second (excluding embedded resources):每秒点击次数</li>
<li>Codes Per Second (excluding embedded resources)：每秒状态码数量</li>
<li>Transactions Per Second：即TPS，每秒事务数</li>
<li>Response Time Vs Request：响应时间和请求数对比</li>
<li>Latency Vs Request：延迟时间和请求数对比</li>
</ul>
<h4 id="Response-Times"><a href="#Response-Times" class="headerlink" title="Response Times"></a>Response Times</h4><ul>
<li>Response Time Percentiles：响应时间百分比</li>
<li>Response Time Overview：响应时间概述</li>
<li>Time Vs Threads：活跃线程数和响应时间</li>
<li>Response Time Distribution：响应时间分布图</li>
</ul>
<h1 id="安装常见问题"><a href="#安装常见问题" class="headerlink" title="安装常见问题"></a>安装常见问题</h1><p>问题1：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[root@iZwz95j86y235aroi85ht0Z bin]# .&#x2F;jmeter-server</span><br><span class="line">	Created remote object: UnicastServerRef2 [liveRef: [endpoint:[:39308](local),objID:[24e78a63:16243c70661:-7fff, 7492480871343944173]]]</span><br><span class="line">	Server failed to start: java.rmi.RemoteException: Cannot start. Unable to get local host IP address.; nested exception is:</span><br><span class="line">	java.net.UnknownHostException: iZwz95j86y235aroi85ht0Z: iZwz95j86y235aroi85ht0Z: Name or service not known</span><br><span class="line">	An error occurred: Cannot start. Unable to get local host IP address.; nested exception is:</span><br><span class="line">	java.net.UnknownHostException: iZwz95j86y235aroi85ht0Z: iZwz95j86y235aroi85ht0Z: Name or service not known</span><br></pre></td></tr></table></figure>

<p>解决方式：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">hostname  命令获取机器名称，追加一个映射  iZwz95j86y235aroi85ht0Z</span><br><span class="line">		vim &#x2F;etc&#x2F;hosts</span><br><span class="line">			127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4</span><br><span class="line">			::1         localhost localhost.localdomain localhost6 localhost6.localdomain6</span><br><span class="line">			120.79.160.143 iZwz95j86y235aroi85ht0Z</span><br><span class="line"></span><br><span class="line">windows用户 修改c:\windows\system32\drivers\etc\hosts文件，增加一条域名 与IP的映射</span><br></pre></td></tr></table></figure>

<ol start="2">
<li>问题如下：</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">[root@iZwz95j86y235aroi85ht0Z bin]# .&#x2F;jmeter-server</span><br><span class="line">	Server failed to start: java.rmi.server.ExportException: Listen failed on port: 0; nested exception is:</span><br><span class="line">	java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)</span><br><span class="line">	An error occurred: Listen failed on port: 0; nested exception is:</span><br><span class="line">	java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)</span><br></pre></td></tr></table></figure>

<p>解决：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">拥有RMI over SSL的有效密钥库，或者禁用了SSL。</span><br><span class="line">1、禁用SSL</span><br><span class="line">  jmeter.property里面 server.rmi.ssl.disable 改为 true，表示禁用</span><br></pre></td></tr></table></figure>

<p>3、问题：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">[root@iZ949uw2xehZ bin]# .&#x2F;jmeter</span><br><span class="line">		Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error&#x3D;&#39;Cannot allocate memory&#39; (errno&#x3D;12)</span><br><span class="line">		#</span><br><span class="line">		# There is insufficient memory for the Java Runtime Environment to continue.</span><br><span class="line">		# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.</span><br><span class="line">		# An error report file with more information is saved as:</span><br><span class="line">		# &#x2F;usr&#x2F;local&#x2F;jmeter&#x2F;apache-jmeter-4.0&#x2F;bin&#x2F;hs_err_pid5855.log</span><br></pre></td></tr></table></figure>

<p>解决：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">编辑jmeter</span><br><span class="line">搜索 : &quot;$&#123;HEAP:&#x3D;&quot;-Xms1g -Xmx1g -XX:MaxMetaspaceSize&#x3D;256m&quot;&#125;&quot;</span><br><span class="line">改变初始堆内存和最大堆内存</span><br></pre></td></tr></table></figure>

<p>4、仅修改 server_port 即可,下面两者一样</p>
<p>server.rmi.localport=8899 表示slave server启动显示的端口</p>
<p>server_port=8899  表示master机器要远程连接的端口   即 remote_hosts=xxxx:8899</p>
<p>5、jmeter 分布式性能测试（多网卡配置）</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">&lt;!-- jmeter 分布式性能测试（多网卡配置） --&gt;</span><br><span class="line">我们要在多网卡的服务器上开启RMI服务的话必须指定IP，使他们能够在同一个网段内。 </span><br><span class="line"></span><br><span class="line">需要以下几步（假定所有机器都在10.120.11.*网段,agent服务器为linux,controller服务器为windows）：</span><br><span class="line"></span><br><span class="line">1、 修改agent服务器，指定agent机器的IP</span><br><span class="line">修改jmeter-server文件</span><br><span class="line"># vi jmeter-server</span><br><span class="line">修改RMI_HOST_DEF&#x3D;-Djava.rmi.server.hostname&#x3D;xxx.xxx.xxx.xxx(需要连接的IP)</span><br><span class="line"></span><br><span class="line">2、修改server服务器，指定server机器的IP</span><br><span class="line"></span><br><span class="line">修改jmeter.bat文件 </span><br><span class="line"></span><br><span class="line">新增set rmi_host&#x3D;-Djava.rmi.server.hostname&#x3D;10.120.11.214</span><br><span class="line"></span><br><span class="line">修改set ARGS&#x3D;%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %PERM% %DDRAW% %rmi_host%</span><br></pre></td></tr></table></figure>

<p>6、确定在controller机器上安装jdk,版本和jmeter一致，配置环境变量：Java_home等</p>
<ul>
<li><p>在Agent机器上安装jdk，配置环境变量：Java_home和JMeter_home</p>
</li>
<li><p>安装目录不要带空格，最好都是简短的英文路径</p>
</li>
</ul>
<p>7、master机器启动后会拷贝jmx文件到slave机器，所以不需要在每台slave机器上也上传一份jmx，只需要在master机器上上传一份jmx脚本即可。</p>
<pre><code>如果使用csv进行参数化，则需要把参数文件在每台slave上拷一份且路径需要设置成一样的。

总样本数 = 线程数 * 循环次数 * 执行机总数</code></pre><p>8、连接失败原因排查</p>
<p>以下步骤进行排查：</p>
<pre><code>1. jmeter-server是否启动；
2. 是否联网
 3. ping 服务器IP是否畅通.
 4. telnet 端口 192.168.3.10 1099
 5. 检查服务器的防火墙是否关闭。
 6. 阿里云安全策略是否正常</code></pre><p>9、出现：”could not find ApacheJmeter_core.jar”</p>
<pre><code>**解决：在Agent机器安装jdk，并设置环境变量**</code></pre><p>10、出现：”Bad call to remote host”</p>
<p>解决：检查被控制机器上的jmeter-server有没有启动，或者remote_hosts的配置是否正确。</p>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kity@2.0.4/dist/kity.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kityminder-core@1.4.50/dist/kityminder.core.min.js"></script><script defer="true" type="text/javascript" src="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.css">
    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>lazytime
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://whitestore.top/2021/01/18/jmeter-test4/" title="Jmeter压力测试回顾(四)">https://whitestore.top/2021/01/18/jmeter-test4/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLzQuMC96aC1DTg=="><i class="fa fa-fw fa-creative-commons"></i>BY-NC</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E6%B5%8B%E8%AF%95/" rel="tag"># 测试</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/01/18/jmeter-test3/" rel="prev" title="Jmeter压力测试回顾(三)">
      <i class="fa fa-chevron-left"></i> Jmeter压力测试回顾(三)
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/01/18/licai/" rel="next" title="《穷爸爸与富爸爸》读书笔记">
      《穷爸爸与富爸爸》读书笔记 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#回顾Jmeter压力测试（四）"><span class="nav-number">1.</span> <span class="nav-text">回顾Jmeter压力测试（四）</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#非GUI部分"><span class="nav-number">1.1.</span> <span class="nav-text">非GUI部分</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#阿里云安装jmeter（jmeter5）"><span class="nav-number">1.2.</span> <span class="nav-text">阿里云安装jmeter（jmeter5）</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Jmeter非GUI界面-参数讲解-必须掌握"><span class="nav-number">1.2.1.</span> <span class="nav-text">Jmeter非GUI界面 参数讲解(必须掌握)</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#基础命令参数："><span class="nav-number">1.2.1.1.</span> <span class="nav-text">基础命令参数：</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#如何使用linux-jmeter压测？"><span class="nav-number">1.2.2.</span> <span class="nav-text">如何使用linux jmeter压测？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Jmeter压测减少资源使用的一些建议，即压测结果更准确"><span class="nav-number">1.2.3.</span> <span class="nav-text">Jmeter压测减少资源使用的一些建议，即压测结果更准确</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Jmeter压测结果聚合报告分析"><span class="nav-number">1.3.</span> <span class="nav-text">Jmeter压测结果聚合报告分析</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#dashboard结果分析："><span class="nav-number">1.3.1.</span> <span class="nav-text">dashboard结果分析：</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Test-and-Report-informations"><span class="nav-number">1.3.1.1.</span> <span class="nav-text">Test and Report informations</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#APDEX-Application-performance-Index"><span class="nav-number">1.3.1.2.</span> <span class="nav-text">APDEX(Application performance Index)</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Requests-Summary"><span class="nav-number">1.3.1.3.</span> <span class="nav-text">Requests Summary:</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Statistics-统计数据"><span class="nav-number">1.3.1.4.</span> <span class="nav-text">Statistics 统计数据</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#charts讲解"><span class="nav-number">1.3.2.</span> <span class="nav-text">charts讲解</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Over-Time（随着时间的变化）"><span class="nav-number">1.3.2.1.</span> <span class="nav-text">Over Time（随着时间的变化）</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Throughput"><span class="nav-number">1.3.2.2.</span> <span class="nav-text">Throughput</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Response-Times"><span class="nav-number">1.3.2.3.</span> <span class="nav-text">Response Times</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#安装常见问题"><span class="nav-number">2.</span> <span class="nav-text">安装常见问题</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">阿东</p>
  <div class="site-description" itemprop="description">随遇而安</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">239</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">36</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">37</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2xhenlUaW1lcw==" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;lazyTimes"><i class="fa fa-fw fa-github"></i>GitHub</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOjEwOTc0ODM1MDhAcXEuY29t" title="E-Mail → mailto:1097483508@qq.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</span>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      友情链接
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly93d3cuNTJwb2ppZS5jbi9ob21lLnBocD9tb2Q9c3BhY2UmdWlkPTE0OTc3MTgmZG89dGhyZWFkJnZpZXc9bWUmZnJvbT1zcGFjZQ==" title="https:&#x2F;&#x2F;www.52pojie.cn&#x2F;home.php?mod&#x3D;space&amp;uid&#x3D;1497718&amp;do&#x3D;thread&amp;view&#x3D;me&amp;from&#x3D;space">吾爱破解</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9qdWVqaW4uaW0vdXNlci8yOTk5MTIzNDUyNjI2MzY2" title="https:&#x2F;&#x2F;juejin.im&#x2F;user&#x2F;2999123452626366">掘金</span>
        </li>
        <li class="links-of-blogroll-item">
          <span class="exturl" data-url="aHR0cHM6Ly9zZWdtZW50ZmF1bHQuY29tL3UvbGF6eXRpbWVz" title="https:&#x2F;&#x2F;segmentfault.com&#x2F;u&#x2F;lazytimes">思否</span>
        </li>
    </ul>
  </div>

      </div>

      <div class="wechat_OA">
        <span>欢迎关注我的公众号</span>
        <br>
          <!-- 这里添加你的二维码图片 -->
        <img src ="https://adong-picture.oss-cn-shenzhen.aliyuncs.com/adong/wechat_channel.jpg">
      </div>
        <div class="back-to-top motion-element">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">阿东</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    <span title="站点总字数">2m</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">29:50</span>
</div>
  <div class="powered-by">由 <span class="exturl theme-link" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> & <span class="exturl theme-link" data-url="aHR0cHM6Ly90aGVtZS1uZXh0Lm9yZw==">NexT.Gemini</span> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : true,
      appId      : 'qMUpEEvBgXaMDD1b0ftgi9xr-gzGzoHsz',
      appKey     : 'UCdfT4Rfih6MO6y8DI4fstf6',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : 'zh-CN' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
